import io
import os
import numpy as np
import shutil
import matplotlib.pyplot as plt
import pandas as pd

file_names = []

np.set_printoptions(threshold=np.inf)

Max = 0
Min = 10000

i = 0

FILE_PATH = r'D:\model_100\valid'

flie_dir = os.listdir(FILE_PATH)

for file in flie_dir:
    # print(not os.path.isdir(file), file.endswith(".dat"), os.path.isfile(file))
    if not file.endswith(".dat"):
        continue

    data = np.array(pd.read_csv(os.path.join(FILE_PATH, file), sep='\\s+', header=None))
    data = data[:, 1]

    max = np.max(data)
    min = np.min(data)

    if Max < max:
        Max = max

    if Min > min:
        Min = min

    i = i + 1
    if not (i % 1000):
        print("第" + str(i) + "个文件比较完成")

print("\n共" + str(i) + "个文件比较完成")
print("最大值：%f" % Max, '\n最小值:%f' % Min)

